Target Parameterization for Presentations
Presentations may be parameterized through targets - which is an variation of the "filter" mechanism. When content is loaded directly, either through URL loading or through iframe embedding, it is often convenient to allow users to change the targeted item's values using external input. This process is known as external parameterization.
Direct URL Loading
To parameterize a presentation, start by adding a Target and then create an interaction between the target and the relevant visual.
Parameterize the presentation's URL for direct content loading, using the following syntax:
{YourPyramidSite}/direct/?id={content identifier}&target[Target Name]=[Dimension].[Hierarchy].[Member]:[Dimension].[Hierarchy].[Member]
The following simple example pushes the countries France and Germany to the target Product Category on launch:
{YourPyramidSite}/direct/?id={content identifier}&target[Product Category]=[customers].[Country].[France]:[customers].[country].[Germany]
Cube and BW Targets
If you are parameterizing a target that is interacting with a visual from an MS OLAP, Tabular, or BW data source, you need to add the appropriate flag to the URL after the target's name.
MS OLAP / Tabular
If the target connects to a visual from a cube model, add ":MS" after the target's name: "&target[Target1:MS]="
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17&target[Target1:MS]=[customers].[Country].[France]
SAP BW
If the target connects to a visual from a BW model, add ":BW" after the target's name: "&target[Target1:BW]="
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[Target1:BW]=[customers].[Country].[France]
Embedded Content
Use JavaScript to parameterize an embedded presentation:
var target = {
name: 'Target 1',
filters: [
{ value: '[customers].[country].[France]' },
{ value: '[customers].[country].[Germany]' },
],
olap: false
}
var params = {
targets: [target]
}
Example: Embed Presentation
//embed the presentation in the container
var countryFilter = { value: '[customers].[country].[France]' };
var target = { name: 'Target 1', filters: [countryFilter], olap: false };
pyramid.embed(document.getElementById('myDiv')), {
id: "f8d66c64-893b-43fc-8049-e9b710ec90f9",
host: "https://mysite",
contentType: "storyboard",
params: { targets: [target] }
});
Example: Add Filters and Targets
//use two filters and two targets
const filter1 = Filter.create().addUniqueName('MEMBER_UNIQUE_NAME');
const filter2 = Filter.create().addUniqueName('MEMBER_UNIQUE_NAME');
const target = Target.create()
.add(filter1, 'Target1' /* targetName */, false /* isOlap */)
.add(filter2, 'Target2' /* targetName */, false /* isOlap */);
embedClient.embed(container, {
contentId: 'eb84f0af-f996-4850-a5ed-795d5af78513',
targets: target,
});
Target Parameterization Examples
The basic syntax of the URL is as follows:
{YourPyramidSite}/direct/?id={content identifier}
&target[Target Name]=[Dimension].[Hierarchy].[Member]:[Dimension].[Hierarchy].[Member]
Note: The unique names are presented as a colon-separated list. In this case, two Members are being fed to the target with the name "Target Name."
Example 1: Push France and Germany to Country Target
The example below will filter the target visuals in the presentation according to the &target called 'Country', by the member elements 'France' and Germany':
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[Country]=[customers].[Country].[France]:[customers].[country].[Germany]
Here, an interaction was added from the grid on Slide 1 to the target called Product Category:
Next, an interaction was added from that target to the map on Slide 2:
The following URL was entered, feeding the Product Category filter with the elements Bikes and Clothing, causing the visual to be filtered (blue highlight below):
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[Product Category]=[products].[Product Category].[Bikes]:[products].[Product Category].[Clothing]
Example 2: Multiple Targets
A separate target is required for each hierarchy that will be used to filter the target visual. However, multiple member elements can be used as a filter for each target, as long as each member element belongs to the same hierarchy.
In the example below, the target visual will be filtered by two targets: Product Category and Manufacturer. The target called 'Product Category' will be used to filter by the 'Bikes' element (from the Product Category hierarchy), while the target called 'Manufacturer' will be used to filter by the 'Acme' element (from the Manufacturer hierarchy).
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[Product Category]=[products].[Product Category].[Bikes]
&target[Manufacturer]=[manufacturers].[Manufacturer].[Acme]
Here, two targets were added: Product Category and Manufacturer. An interaction was added from the grid on Slide 1 to each of the targets:
Next, an interaction was added from each target to the map on Slide 2:
The following URL was entered, filtering the visual by the elements the 'Acme' element from the Manufacturer hierarchy, and the 'Bikes' element from the Product Category hierarchy:
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[Product Category]=[products].[Product Category].[Bikes]
&target[Manufacturer]=[manufacturers].[Manufacturer].[Acme]
Example 3: Initialize Visuals for Selected Dates
Pyramid supports using PQL functions in URL parameters. This example initializes the presentation visual for a selected date range on launch. Date range parameters (defined using PQL) are passed to the target as part of the URL:
https://eg.pyramdanalytics.com/direct/?id=direct?id=134fd567-d6e3-4b8e-9484-b720d4e39a17
&target[DateRange]=%7B[data].[dateKey]:SET:%7BRANGE(DateSelection([data].[dateKey],"2010-12-30",5),DateSelection([data].[dateKey],"2010-12-31",5))%7D%7D
It is important to note that the {braces} that are required to define this range need to be escaped for use.
Since we want to initialize the visual for a particular date range, from 30-Dec-2010 to 31-Dec-2010, we need to add a Target to the presentation that will be used "feed" our date range to the visual. In this case, the target is called DateRange and the defined interaction flows FROM the target TO the visual:
We have a number choices for passing our two-date range to the presentation when we open it from a direct URL:
Option 1: Filter by Dates (Simple)
The simplest value for the &target query parameter that filters the visual for two dates is a simple colon separated list of dates:
&target[DateRange]=[data].[dateKey].[2010-12-30]:[data].[dateKey].[2010-12-31]
Option 2: Filter by Date Range (Set)
To create a range that contains the same two dates and add it to the &target query parameter instead:
&target[DateRange]=%7B[data].[dateKey]:SET:%7BRANGE(DateSelection([data].[dateKey],"2010-12-30",5),DateSelection([data].[dateKey],"2010-12-31",5))%7D%7D
The data passed to the DateRange target is a PQL expression with the following details:
- This expression is setting the date RANGE.
- The start and end dates in the range are each selected from the model using the DateSelection function, which gets each date from the dateKey hierarchy.
- The {braces} are escaped using the standard %7B and %7D escape characters.
When the presentation is launched using a URL with either of the previous query parameters, the visual is filtered to include data from the date range 2010-12-30 to 2010-12-31 and the filter is described in the breadcrumbs (blue highlight below):
Note: Certain URLs may not work due to special characters in the URL parameter values. To ensure proper functionality, these parameter values must be URL-encoded.
Related information
Direct URLs to Discoveries
If your URL points to a discovery, you need to change from the &target shown above to the &filter approach.
- Click here for more about Filter Parameterization